package com.hsmpay.mobile.service.bank.impl;

import com.hsmpay.common.service.impl.BaseServiceSupport;
import com.hsmpay.mobile.dao.bank.BankBranchesDao;
import com.hsmpay.mobile.pojo.bank.BankBranches;
import com.hsmpay.mobile.service.bank.BankBranchesService;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * 合作银行支行业务接口 bankService
 * 对应数据层 bankDao
 *
 * @param <Entity>
 * @param <Query>
 * @author 颜铃璋
 * @date 2013-3-25
 */
@Repository("bankBranchesService")
public class BankBranchesServiceImpl extends BaseServiceSupport<BankBranches, Long> implements BankBranchesService<BankBranches, Long> {
    @Resource(name = "bankBranchesDao")
    BankBranchesDao<BankBranches, Long> bankBranchesDao;

    /**
     * 根据Id 查询支行
     *
     * @param id
     * @return
     * @throws Exception
     */
    public BankBranches searchBankBranchesById(Long id) throws Exception {
        BankBranches param = new BankBranches();
        param.setId(id);
        param.setInvalid(1);
        return bankBranchesDao.searchEntity(param);
    }

    /**
     * 查询支行列表
     *
     * @param bankBranches
     * @return
     * @throws Exception
     */
    public List<BankBranches> searchBankBranchesList(BankBranches bankBranches) throws Exception {
        BankBranches param = new BankBranches();
        param.setBankId(bankBranches.getBankId());
        param.setProvince(bankBranches.getProvince());
        param.setOtherParam(bankBranches.getOtherParam());
        param.setName(bankBranches.getName());
        param.setStart(bankBranches.getStart());
        param.setStop(bankBranches.getStop());
        param.setInvalid(1);
        return bankBranchesDao.searchEntityList(param);
    }

//	/**
//	 * 查询支行列表 
//	 * @param bankBranches
//	 * @return
//	 * @throws Exception
//	 */
//	public List<BankBranches> searchBankBranchesList(BankBranches bankBranches)throws Exception{
//		BankBranches param = new BankBranches();
//		param.setBankId(bankBranches.getBankId());
//		param.setProvince(bankBranches.getProvince());
//		param.setOtherParam(bankBranches.getOtherParam());
//		param.setName(bankBranches.getName());
//		param.setStart(bankBranches.getStart());
//		param.setStop(bankBranches.getStop());
//		if(bankBranches.getProvince() == 20){//广西
//			switch(bankBranches.getCity()){
//				case 6140://柳州
//					param.setOtherParam(" ( CITY=6140 OR CITY=6141 OR CITY=6142 OR CITY=6152 OR CITY=6156 OR CITY=6157 OR CITY=6158 ) ");
//					break;
//				case 6155://来宾市
//					param.setOtherParam(" ( CITY=6155 OR CITY=6151 OR CITY=6153 OR CITY=6154 OR CITY=6159 OR CITY=6161 ) ");
//					break;
//				case 6210://梧州市
//					param.setOtherParam(" ( CITY=6210 OR CITY=6211 OR CITY=6221 OR CITY=6222 OR CITY=6224 ) ");
//					break;
//				case 6225://贺州市
//					param.setOtherParam(" ( CITY=6225 OR CITY=6223 OR CITY=6226 OR CITY=6227 ) ");
//					break;
//				case 6240://玉林市
//					param.setOtherParam(" ( CITY=6240 OR CITY=6245 OR CITY=6246 OR CITY=6247 OR CITY=6248 OR CITY=6249 ) ");
//					break;
//				case 6311://钦州市
//					param.setOtherParam(" ( CITY=6311 OR CITY=6314 OR CITY=6315 ) ");
//					break;
//				case 6330://钦州市
//					param.setOtherParam(" ( CITY=6330 OR CITY=6312 OR CITY=6331 ) ");
//					break;
//			}
//		}else if(bankBranches.getProvince() == 22){//
//			switch(bankBranches.getCity()){
//				case 6630://柳州
//					param.setOtherParam(" ( CITY=6630 OR CITY=6634 OR CITY=6635 OR CITY=6638 ) ");
//					break;
//				case 6650://乐山市
//					param.setOtherParam(" ( CITY=6650 OR CITY=6653 OR CITY=6654 OR CITY=6655 OR CITY=6658 OR CITY=6662 OR CITY=6663 OR CITY=6664 ) ");
//					break;
//				case 6636://资阳市
//					param.setOtherParam(" ( CITY=6636 OR CITY=6632 OR CITY=6633 OR CITY=6637 ) ");
//					break;
//				case 6652://眉山市
//					param.setOtherParam(" ( CITY=6652 OR CITY=6651 OR CITY=6652 OR CITY=6656 OR CITY=6657 OR CITY=6659 OR CITY=6665 ) ");
//					break;
//				case 6730://南充市
//					param.setOtherParam(" ( CITY=6730 OR CITY=6734 OR CITY=6736 OR CITY=6738 OR CITY=6739 OR CITY=6742 OR CITY=6743 ) ");
//					break;
//				case 6737://广安市 
//					param.setOtherParam(" ( CITY=6737 OR CITY=6732 OR CITY=6735 OR CITY=6737 OR CITY=6741 OR CITY=6763 ) ");
//					break;
//				case 6750://达州市
//					param.setOtherParam(" ( CITY=6750 OR CITY=6752 OR CITY=6753 OR CITY=6754 OR CITY=6755 OR CITY=6761 OR CITY=6762 ) ");
//					break;
//				case 6758://巴中市
//					param.setOtherParam(" ( CITY=6758 OR CITY=6756 OR CITY=6757 OR CITY=6759 ) ");
//					break;	
//				
//			}
//		}else if(bankBranches.getProvince() == 30){//
//			switch(bankBranches.getCity()){
//				case 8720://石嘴山市
//					param.setOtherParam(" ( CITY=8720 OR CITY=8721 OR CITY=8723 ) ");
//					break;
//				case 8731://吴忠市
//					param.setOtherParam(" ( CITY=8731 OR CITY=8732 OR CITY=8736 OR CITY=8737 ) ");
//					break;
//				case 8733://中卫市
//					param.setOtherParam(" ( CITY=8733 OR CITY=8734 OR CITY=8742 ) ");
//					break;
//				case 8741://固原市
//					param.setOtherParam(" ( CITY=8741 OR CITY=8743 OR CITY=8744 OR CITY=8745 OR CITY=8746 ) ");
//					break;
//			}
//		}else if(bankBranches.getProvince() == 19){
//			switch(bankBranches.getCity()){
//				case 5865://揭阳市
//					param.setOtherParam(" ( CITY=5865 OR CITY=5866 OR CITY=5867 OR CITY=5868 OR CITY=5871 ) ");
//				break;
//				case 5869://潮州市
//					param.setOtherParam(" ( CITY=5869 OR CITY=5872 OR CITY=5862 ) ");
//					break;
//				case 5860://汕头市
//					param.setOtherParam(" ( CITY=5860 OR CITY=5861 OR CITY=5863 OR CITY=5864 ) ");
//					break;
//			}
//		}else if(bankBranches.getProvince() == 17){
//			switch(bankBranches.getCity()){
//				case 5280://襄樊市
//					param.setOtherParam(" ( CITY=5280 OR CITY=5865 OR CITY=5282 OR CITY=5283 OR CITY=5284 OR CITY=5285 OR CITY=5287 OR CITY=5288 ) ");
//					break;
//				case 5286://随州市
//					param.setOtherParam(" ( CITY=5286 OR CITY=5354 ) ");
//					break;
//				case 5320://荆门市
//					param.setOtherParam(" ( CITY=5320 OR CITY=5381 OR CITY=5382 OR CITY=5383 ) ");
//					break;
//				case 5311://鄂州市
//					param.setOtherParam(" ( CITY=5311 ) ");
//					break;
//				case 5350://孝感市
//					param.setOtherParam(" ( CITY=5350 OR CITY=5351 OR CITY=5352 OR CITY=5352 OR CITY=5353 OR CITY=5355 OR CITY=5356 OR CITY=5357) ");
//					break;	
//				case 5360://咸宁市
//					param.setOtherParam(" ( CITY=5360 OR CITY=5362 OR CITY=5363 OR CITY=5364 OR CITY=5365 OR CITY=5366) ");
//					break;	
//			}
//		}else if(bankBranches.getProvince() == 15){//山东
//			switch(bankBranches.getCity()){
//				case 4732://日照市
//					param.setOtherParam(" ( CITY=4732 OR CITY=4587 OR CITY=4736 ) ");
//					break;
//				case 4580://潍坊市 4580  4581  4582  4583  4584 4585 4586 4588 4589  日照市的 4587 在 潍坊市中
//					param.setOtherParam(" ( CITY=4580 OR CITY=4581 OR CITY=4582 OR CITY=4583 OR CITY=4584 OR CITY=4585 OR CITY=4586 OR CITY=4588 OR CITY=4589) ");
//					break;
//				case 4730://临沂市：4730 4733 4734 4735 4737 4739 4741 4742 4743 4744 日照市的 4736 在 潍坊市中
//					param.setOtherParam(" ( CITY=4730 OR CITY=4733 OR CITY=4734 OR CITY=4735 OR CITY=4737 OR CITY=4739 OR CITY=4741 OR CITY=4742 OR CITY=4743 OR CITY=4744) ");
//					break;
//				case 4630://泰安市 4630 4631 4632 4633 4635 莱芜市 4634 在泰安市中
//					param.setOtherParam(" ( CITY=4630 OR CITY=4631 OR CITY=4632 OR CITY=4633 OR CITY=4635) ");
//					break;
//				case 4634://莱芜市 4634
//					param.setOtherParam(" ( CITY=4634) ");
//					break;
//				case 4610://济宁市 4610 4611 4612 4613 4614 4615 4616 4617  4618 4619 4757 济宁市 4757 在 荷泽市
//					param.setOtherParam(" ( CITY=4610 OR CITY=4611 OR CITY=4612 OR CITY=4613 OR CITY=4614 OR CITY=4615 OR CITY=4616 OR CITY=4617 OR CITY=4618 OR CITY=4619 OR CITY=4757) ");
//					break;
//				case 4750://荷泽市 4750 4752 4753 4754 4755 4756 4758 4759 4761
//					param.setOtherParam(" ( CITY=4750 OR CITY=4752 OR CITY=4753 OR CITY=4754 OR CITY=4755 OR CITY=4756 OR CITY=4758 OR CITY=4759 OR CITY=4761) ");
//					break;
//			}
//		}
//		return searchEntityList(param);
//	}
}
